﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Proggy.Web.Cms.PropertyTypes;
using Newtonsoft.Json;

namespace Proggy.Web.Cms.Core.PropertyTypes
{
    /// <summary>
    /// Raw Html property type
    /// </summary>
    [PropertyType("Raw HTML", "~/Areas/ProggyCore/Views/EditorPartials/RawHtml.cshtml")]
    public class RawHtml : PropertyTypeBase, IValidatablePropertyType, IAutoRenderPropertyType
    {
        /// <summary>
        /// The Html
        /// </summary>
        public string TheHtml { get; set; }

        #region interface

        public object GetAutoRenderModel()
        {
            return this;
        }

        [JsonIgnore]
        public string FullPathToAutoRenderPartial
        {
            get { return "~/Areas/ProggyCore/Views/AutoRenderPartials/_RawHtml.cshtml"; }
        }

        public Tuple<bool, string> GetIsValid(System.ComponentModel.DataAnnotations.ValidationContext vContext, ContentModel.ContentModelPropertyTypeAttribute attr)
        {
            // always ok
            return new Tuple<bool, string>(true, "");
        }

        #endregion
    }
}
